

Dim conn, rst, SQL_Table



Set conn = CreateObject("ADODB.Connection")
Set rst = CreateObject("ADODB.Recordset")


conn.Open "Provider=MSDASQL;Initial Catalog=" & SmartTags("alpdatabase") & ";DSN="&Database_Name&"" 




SQL_Table = "SELECT * FROM " & SmartTags("alptablename") & " WHERE Nr = " & SmartTags("nDat_No")  


Set rst = conn.Execute(SQL_Table)


	
	SmartTags("nDatNoTable") = rst.Fields(0).Value
	SmartTags("nValue_1") = rst.Fields(1).Value
	SmartTags("nValue_2") = rst.Fields(2).Value
	SmartTags("nValue_3") = rst.Fields(3).Value 
	SmartTags("alp_1") = rst.Fields(1).Name
	SmartTags("alp_2") = rst.Fields(2).Name
	SmartTags("alp_3") = rst.Fields(3).Name 
	
	rst.close 

conn.close

Set rst = Nothing
Set conn = Nothing

End Sub